<template>
    <div>
        <ul class="mui-table-view">
            <li v-for="item in newslist" :key="item.id" class="mui-table-view-cell mui-media">
                <router-link :to="'/home/newslist/newsinfo/'+item.id">
                      <img class="mui-media-object mui-pull-left" :src="item.url">
                    <div class="mui-media-body">
                        <h1>{{item.content}}</h1>
                        <p class='mui-ellipsis'>
                            <span>
                                发表时间：{{item.date }}
                            </span>
                            <span>
                                点击：{{item.clicktime}}次
                            </span>

                        </p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>

</template>

<script>
    import {Toast} from 'mint-ui'
    export default {
        name: "news-list",
        data(){
            return{
                newslist:[]
            }
        },
        created(){
            this.getNewsList()
        },
        methods:{
            getNewsList(){
                this.$http.get("http://192.168.1.237:9090/test33/test.php").then(result=>{
                    if(result.body.code==0){
                        this.newslist=result.body.newslist;
                    }else {
                        Toast("加载列表数据失败。。。")
                    }
                })
            }
        }
    }
</script>

<style scoped>
    .mui-media-body h1{
        font-size: 12px;
    }
    .mui-ellipsis {
        font-size: 12px;
        color: #007aff;
        display: flex;
        justify-content: space-between;
    }
</style>